<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@include file="../common/include.jsp"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>数据导入</title>
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">

	<script type="text/javascript" src="<%=basePath %>template/common/js/jquery-1.7.js"></script> 
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
	<SCRIPT type="text/javascript">
		//去右空格;   
		function rtrim(s){   
		  return s.replace(/(\s*$)/, "");  
		} 
		function importExcel(form){
			var filePath = rtrim($("#filePathId").val());
			if(filePath==""||filePath==null){
				alert("请选择要解释的xlsx文件！");
			}else{
				var index = filePath.lastIndexOf(".");
				var xmlStr = filePath.substring(index,filePath.length);
				if(xmlStr!=".XLSX"&&xmlStr!=".xlsx"){
					alert("导入文件只能为xlsx格式！");
				}else{
					form.action = "<%=basePath%>data/excel_import!importExcel.action";
					form.submit();
				}
			}
		}
	</SCRIPT>
  </head>
  
  <body>
  <s:if test="#request.pageFlag=='success'">
   <div>导入成功:其中有效导入新数据${saveCount }条，覆盖数据${updateCount }条</div>
   </s:if>
   <s:if test="#request.pageFlag=='error'">
   	<div>导入错误:<br>
   		<s:iterator var="msg" value="#request.errMsg"  status="st" >
   			<span>${msg }</span><br>
   		</s:iterator>
   	</div>
   </s:if>
  	<table>
  		<s:form action ="" method ="POST" enctype ="multipart/form-data"  id="fileForm" target="_self" > 
    	<tr><td><input type="radio" name="dataType" value="itemData" <s:if test="#request.dataType=='itemData'">checked</s:if> <s:if test="#request.dataType==null">checked</s:if>/>量子数据</td></tr>
    	<tr><td><input type="radio" name="dataType" value="stores" <s:if test="#request.dataType=='stores'">checked</s:if>/>店铺属性</td></tr>
    	<tr><td><input type="radio" name="dataType" value="storesproperties" <s:if test="#request.dataType=='storesproperties'">checked</s:if>/>店铺属性参数</td></tr>  
    	<tr><td><input type="radio" name="dataType" value="taskcost" <s:if test="#request.dataType=='taskcost'">checked</s:if>/>销售任务&任务成本 </td></tr>  
    	<tr><td><input type="radio" name="dataType" value="products" <s:if test="#request.dataType=='products'">checked</s:if> />商品属性</td></tr>
    	<tr><td><input type="radio" name="dataType" value="reasons" <s:if test="#request.dataType=='reasons'">checked</s:if>/>退货原因 </td></tr>
    	<tr><td><input type="radio" name="dataType" value="expresses" <s:if test="#request.dataType=='expresses'">checked</s:if>/>快递公司</td></tr>
    	<tr><td><input type="radio" name="dataType" value="expressfees" <s:if test="#request.dataType=='expressfees'">checked</s:if>/>运费</td></tr>
    	<tr><td><input type="radio" name="dataType" value="warehousesarea" <s:if test="#request.dataType=='warehousesarea'">checked</s:if>/>仓库编号及辖区</td></tr>
    	<tr><td><input type="radio" name="dataType" value="sales" <s:if test="#request.dataType=='sales'">checked</s:if>/>入仓销售</td></tr>
    	<tr><td>
	    <input type="file" style="width:400px" id="filePathId" name="excelFile">
	    <input class="btn" type="button" value="导入" onclick="importExcel(fileForm)">
	     <input class="btn" type="button" value="返回" onclick="document.location.href='<%=basePath%>admin/admin!index.action'">
	    </td></tr>
    </s:form>
    </table>

    <br>
	    
      </body>
</html>
